package com.space.service;

import com.space.entity.User1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;

@Service
public class TUserService {
    @Autowired
    MongoTemplate mongoTemplate;
    static int c = 0;

    public long getCount(){
        Query query = new Query();
        long l = mongoTemplate.count(query,User1.class);
        return l;
    }

    public User1 getUser(){
        User1 user1 = mongoTemplate.findById(1,User1.class);
        return user1;
    }

    public User1 insertUser(User1 us){
        return mongoTemplate.insert(us);
    }

}
